home *** CD-ROM | disk | FTP | other *** search
/ BBS in a Box 3 / BBS in a box - Trilogy III.iso / Files / Prog / U-Z / VideoToolBox Folder / VideoToolboxSources / Uniform.c < prev    next >
Encoding:
C/C++ Source or Header  |  1993-02-23  |  360 b   |  17 lines  |  [TEXT/KAHL]

  1. /*
  2. Uniform.c
  3. UniformSample() returns a random sample from the interval [0,1). 
  4. It has a mean of 0.5 and a variance of 1/12.
  5.  
  6. HISTORY:
  7. 12/28/91 dgp extracted it from Normal.c
  8. */
  9. #include "VideoToolbox.h"
  10.  
  11. double UniformSample(void)
  12. {
  13.     return rand()*(1.0/(RAND_MAX+1.0));
  14. }
  15. /*
  16. The constant is evaluated by the compiler. Multiplication is faster than division.
  17. */